# 载入套件
import numpy as np
import matplotlib.pyplot as plt



# from skimage.feature import hog
# from skimage import data, exposure
#
#
#
# # 测试图片
# image = data.astronaut()
#
# from skimage import feature as ft
# features = ft.hog(image,  # input image
#                   orientations=ori,  # number of bins
#                   pixels_per_cell=ppc, # pixel per cell
#                   cells_per_block=cpb, # cells per blcok
#                   block_norm = 'L1', #  block norm : str {‘L1’, ‘L1-sqrt’, ‘L2’, ‘L2-Hys’}, optional
#                   transform_sqrt = True, # power law compression (also known as gamma correction)
#                   feature_vector=True, # flatten the final vectors
#                   visualise=False) # return HOG map
#
# # 取得图片的 hog
# fd, hog_image = hog(image, orientations=8, pixels_per_cell=(16, 16),cells_per_block=(1, 1), visualize=True, multichannel=True)
#
# # 原图与 hog图比较
# fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(12, 6), sharex=True, sharey=True)
#
# ax1.axis('off')
# ax1.imshow(image, cmap=plt.cm.gray)
# ax1.set_title('Input image')
#
# # 调整对比，让显示比较清楚
# hog_image_rescaled = exposure.rescale_intensity(hog_image, in_range=(0, 10))
#
# ax2.axis('off')
# ax2.imshow(hog_image_rescaled, cmap=plt.cm.gray)
# ax2.set_title('Histogram of Oriented Gradients')
# plt.show()